﻿using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using YJKAreaStatistic.DataDefine;
using YJKAreaStatistic.Utils;
using YJKRevitBase.Math;
using YJKGeometryFuncs;

namespace YJKAreaStatistic.Manage
{
	internal class AreaCalcManager
	{
		public static double CalcOvergroundArchArea(Autodesk.Revit.DB.Document doc)
		{
			double result = 0.0;
			try
			{
				List<ViewPlan> lstArchPlane = new List<ViewPlan>();
				if (!AreaPlanManager.GetArchAreaPlane(doc, ref lstArchPlane, true))
				{
					return result;
				}
				result = AreaCalcManager.CalcViewPlanArea(lstArchPlane);
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcOvergroundArchArea(List<BaseCellData> lstAllCellData, Autodesk.Revit.DB.Document doc)
		{
			double num = 0.0;
			try
			{
				foreach (BaseCellData baseCellData in lstAllCellData)
				{
					if (baseCellData.RowNum == CellRowValueNumManager.RowKindLevelTotalArchArea && AreaPlanManager.IsLevelOverGround(baseCellData.ColumnValue, doc))
					{
						num += baseCellData.CellValue.ToDouble(0.0);
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return num;
		}

		public static double CalcUndergroundArchArea(Autodesk.Revit.DB.Document doc)
		{
			double result = 0.0;
			try
			{
				List<ViewPlan> lstArchPlane = new List<ViewPlan>();
				if (!AreaPlanManager.GetArchAreaPlane(doc, ref lstArchPlane, false))
				{
					return result;
				}
				result = AreaCalcManager.CalcViewPlanArea(lstArchPlane);
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcUndergroundArchArea(List<BaseCellData> lstAllCellData, Autodesk.Revit.DB.Document doc)
		{
			double num = 0.0;
			try
			{
				foreach (BaseCellData baseCellData in lstAllCellData)
				{
					if (baseCellData.RowNum == CellRowValueNumManager.RowKindLevelTotalArchArea && AreaPlanManager.IsLevelUnderGround(baseCellData.ColumnValue, doc))
					{
						num += baseCellData.CellValue.ToDouble(0.0);
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return num;
		}

		public static double CalcTotalArchArea(Autodesk.Revit.DB.Document doc)
		{
			double result;
			try
			{
				result = AreaCalcManager.CalcOvergroundArchArea(doc) + AreaCalcManager.CalcUndergroundArchArea(doc);
			}
			catch (Exception)
			{
				result = 0.0;
			}
			return result;
		}

		public static double CalcTotalArchArea(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				if (!AreaCalcManager.GetCellData(CellRowValueNumManager.RowOvergroundArchArea, nCol, lstAllCellData, out baseCellData))
				{
					return 0.0;
				}
				BaseCellData baseCellData2;
				if (!AreaCalcManager.GetCellData(CellRowValueNumManager.RowUndergroundArchArea, nCol, lstAllCellData, out baseCellData2))
				{
					return 0.0;
				}
				result = baseCellData.CellValue.ToDouble(0.0) + baseCellData2.CellValue.ToDouble(0.0);
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcTotalInnerArea(int nRowInnerArea, List<BaseCellData> lstHouseCellData)
		{
			double num = 0.0;
			try
			{
				foreach (BaseCellData baseCellData in lstHouseCellData)
				{
					if (baseCellData.RowNum == nRowInnerArea)
					{
						BaseCellData baseCellData2;
						AreaCalcManager.GetCellData(CellRowValueNumManager.RowHouseCount, baseCellData.ColumnNum, lstHouseCellData, out baseCellData2);
						if (baseCellData2 != null)
						{
							num += baseCellData.CellValue.ToDouble(0.0) * baseCellData2.CellValue.ToDouble(0.0);
						}
						else
						{
							num += baseCellData.CellValue.ToDouble(0.0);
						}
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return num;
		}

		public static double CalcItemCount(int nCellCol, List<BaseCellData> lstCellData)
		{
			double num = 0.0;
			try
			{
				foreach (int num2 in new List<int>
				{
					CellRowValueNumManager.RowHalfAreaRangeOne,
					CellRowValueNumManager.RowHalfAreaRangeTwo,
					CellRowValueNumManager.RowHalfAreaRangeThree
				})
				{
					foreach (BaseCellData baseCellData in lstCellData)
					{
						if (baseCellData.RowNum == num2 && baseCellData.ColumnNum == nCellCol)
						{
							num += baseCellData.CellValue.ToDouble(0.0);
						}
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return num;
		}

		public static double CalcInnerUseArea(int nRowInnerArea, int nCellCol, List<BaseCellData> lstHouseCellData)
		{
			double result = 0.0;
			try
			{
				Area area = null;
				foreach (BaseCellData baseCellData in lstHouseCellData)
				{
					if (baseCellData.RowNum == nRowInnerArea && baseCellData.ColumnNum == nCellCol)
					{
						HouseTargetData houseTargetData = baseCellData as HouseTargetData;
						if (houseTargetData != null)
						{
							area = houseTargetData.HouseArea;
						}
					}
				}
				if (area != null)
				{
					result = AreaCalcManager.CalcInnerUseArea(area);
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcInnerUseArea(Area houseArea)
		{
			double num = 0.0;
			try
			{
				List<Room> list = new List<Room>();
				if (AreaParamManager.GetAreaRooms(houseArea, ref list))
				{
					foreach (Room room in list)
					{
						if (!AreaParamManager.IsRoomHalfRegion(room))
						{
							num += UnitUtility.SquareFeetToSquareMeter(room.Area);
						}
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return num;
		}

		public static double CalcPublicShareCoefficient(int nRowInnerArea, int nRowTotalInnerArchArea, int nCol, int nStartCol, List<BaseCellData> lstHouseCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(nRowInnerArea, nCol, lstHouseCellData, out baseCellData);
				BaseCellData baseCellData2;
				AreaCalcManager.GetCellData(nRowTotalInnerArchArea, nStartCol, lstHouseCellData, out baseCellData2);
				if (baseCellData != null && baseCellData2 != null)
				{
					double num = baseCellData2.CellValue.ToDouble(1.0);
					if (Geometry.IsEqual(num, 0.0))
					{
						result = 0.0;
					}
					else
					{
						result = baseCellData.CellValue.ToDouble(0.0) / num;
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcPublicShareArea(int nRowPublicShareCoefficient, int nRowUnitPublicArea, int nCol, int nStartCol, List<BaseCellData> lstCoverCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(nRowPublicShareCoefficient, nCol, lstCoverCellData, out baseCellData);
				BaseCellData baseCellData2;
				AreaCalcManager.GetCellData(nRowUnitPublicArea, nStartCol, lstCoverCellData, out baseCellData2);
				if (baseCellData != null && baseCellData2 != null)
				{
					result = baseCellData.CellValue.ToDouble(0.0) * baseCellData2.CellValue.ToDouble(0.0);
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcLevelTotalInnerArea(string strLevelName, List<BaseCellData> lstHouseCellData)
		{
			double num = 0.0;
			try
			{
				int rowInnerArea = CellRowValueNumManager.RowInnerArea;
				foreach (BaseCellData baseCellData in lstHouseCellData)
				{
					if (baseCellData.RowNum == rowInnerArea && baseCellData.ColumnValue == strLevelName)
					{
						num += baseCellData.CellValue.ToDouble(0.0);
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return num;
		}

		public static double CalcLevelArchArea(string strLevelName, List<BaseCellData> lstTotalCellData)
		{
			double num = 0.0;
			try
			{
				int rowKindLevelArchArea = CellRowValueNumManager.RowKindLevelArchArea;
				foreach (BaseCellData baseCellData in lstTotalCellData)
				{
					if (baseCellData.RowNum == rowKindLevelArchArea && baseCellData.ColumnValue == strLevelName)
					{
						num += baseCellData.CellValue.ToDouble(0.0);
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return num;
		}

		public static double CalcLevelTotalArchArea(int nCol, List<BaseCellData> lstTotalCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				if (!AreaCalcManager.GetCellData(CellRowValueNumManager.RowKindLevelCount, nCol, lstTotalCellData, out baseCellData))
				{
					return 0.0;
				}
				BaseCellData baseCellData2;
				if (!AreaCalcManager.GetCellData(CellRowValueNumManager.RowKindLevelArchArea, nCol, lstTotalCellData, out baseCellData2))
				{
					return 0.0;
				}
				result = baseCellData.CellValue.ToDouble(0.0) * baseCellData2.CellValue.ToDouble(0.0);
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcLevelPublicShareCoefficient(int nRowInnerArea, int nCol, List<BaseCellData> lstHouseCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				if (!AreaCalcManager.GetCellData(nRowInnerArea, nCol, lstHouseCellData, out baseCellData))
				{
					return result;
				}
				double num = AreaCalcManager.CalcLevelTotalInnerArea(baseCellData.ColumnValue, lstHouseCellData);
				if (Geometry.IsEqual(num, 0.0))
				{
					result = 0.0;
				}
				else
				{
					result = baseCellData.CellValue.ToDouble(0.0) / num;
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcLevelPublicShareArea(int nRowLevelShareCoefficient, int nLevelArchArea, int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				if (!AreaCalcManager.GetCellData(nRowLevelShareCoefficient, nCol, lstAllCellData, out baseCellData))
				{
					return 0.0;
				}
				string columnValue = baseCellData.ColumnValue;
				double num = AreaCalcManager.CalcLevelArchArea(columnValue, lstAllCellData);
				double num2 = AreaCalcManager.CalcLevelTotalInnerArea(columnValue, lstAllCellData);
				result = baseCellData.CellValue.ToDouble(0.0) * (num - num2);
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcCoverArea(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowInnerArea, nCol, lstAllCellData, out baseCellData);
				BaseCellData baseCellData2;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowLevelPublicShareArea, nCol, lstAllCellData, out baseCellData2);
				BaseCellData baseCellData3;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowPublicShareArea, nCol, lstAllCellData, out baseCellData3);
				if (baseCellData != null && baseCellData2 != null && baseCellData3 != null)
				{
					result = baseCellData.CellValue.ToDouble(0.0) + baseCellData2.CellValue.ToDouble(0.0) + baseCellData3.CellValue.ToDouble(0.0);
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcSaleArea(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowCoverArea, nCol, lstAllCellData, out baseCellData);
				BaseCellData baseCellData2;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowGiftArea, nCol, lstAllCellData, out baseCellData2);
				if (baseCellData != null && baseCellData2 != null)
				{
					result = baseCellData.CellValue.ToDouble(0.0) + baseCellData2.CellValue.ToDouble(0.0);
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcGiftRatio(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowGiftArea, nCol, lstAllCellData, out baseCellData);
				BaseCellData baseCellData2;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowCoverArea, nCol, lstAllCellData, out baseCellData2);
				if (baseCellData != null && baseCellData2 != null)
				{
					double num = baseCellData2.CellValue.ToDouble(1.0);
					if (Geometry.IsEqual(num, 0.0))
					{
						result = 0.0;
					}
					else
					{
						result = baseCellData.CellValue.ToDouble(0.0) / num;
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcOwnerInRoomRatio(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowInnerArea, nCol, lstAllCellData, out baseCellData);
				BaseCellData baseCellData2;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowCoverArea, nCol, lstAllCellData, out baseCellData2);
				if (baseCellData != null && baseCellData2 != null)
				{
					double num = baseCellData2.CellValue.ToDouble(1.0);
					if (Geometry.IsEqual(num, 0.0))
					{
						result = 0.0;
					}
					else
					{
						result = baseCellData.CellValue.ToDouble(0.0) / num;
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcRealInRoomRatio(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowInnerArea, nCol, lstAllCellData, out baseCellData);
				BaseCellData baseCellData2;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowCoverArea, nCol, lstAllCellData, out baseCellData2);
				BaseCellData baseCellData3;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowGiftArea, nCol, lstAllCellData, out baseCellData3);
				if (baseCellData != null && baseCellData2 != null && baseCellData3 != null)
				{
					double num = baseCellData2.CellValue.ToDouble(0.0) + baseCellData3.CellValue.ToDouble(0.0);
					if (Geometry.IsEqual(num, 0.0))
					{
						result = 0.0;
					}
					else
					{
						result = baseCellData.CellValue.ToDouble(0.0) / num;
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcTotalCellArea(int nRow, List<BaseCellData> lstAllCellData)
		{
			double num = 0.0;
			try
			{
				foreach (BaseCellData baseCellData in lstAllCellData)
				{
					if (baseCellData.RowNum == nRow)
					{
						BaseCellData baseCellData2;
						AreaCalcManager.GetCellData(CellRowValueNumManager.RowHouseCount, baseCellData.ColumnNum, lstAllCellData, out baseCellData2);
						if (baseCellData2 != null)
						{
							num += baseCellData.CellValue.ToDouble(0.0) * baseCellData2.CellValue.ToDouble(0.0);
						}
						else
						{
							num += baseCellData.CellValue.ToDouble(0.0);
						}
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return num;
		}

		public static double CalcOwnerOutRoomRatio(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowTotalUseArea, nCol, lstAllCellData, out baseCellData);
				double num = AreaCalcManager.CalcTotalCellArea(CellRowValueNumManager.RowCoverArea, lstAllCellData);
				if (baseCellData != null)
				{
					if (Geometry.IsEqual(num, 0.0))
					{
						result = 0.0;
					}
					else
					{
						result = baseCellData.CellValue.ToDouble(0.0) / num;
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcRealOutRoomRatio(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowTotalUseArea, nCol, lstAllCellData, out baseCellData);
				double num = AreaCalcManager.CalcTotalCellArea(CellRowValueNumManager.RowSaleArea, lstAllCellData);
				if (baseCellData != null)
				{
					if (Geometry.IsEqual(num, 0.0))
					{
						result = 0.0;
					}
					else
					{
						result = baseCellData.CellValue.ToDouble(0.0) / num;
					}
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcTotalShareArea(int nCol, List<BaseCellData> lstAllCellData)
		{
			double result = 0.0;
			try
			{
				BaseCellData baseCellData;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowTotalInnerArea, nCol, lstAllCellData, out baseCellData);
				BaseCellData baseCellData2;
				AreaCalcManager.GetCellData(CellRowValueNumManager.RowTotalArchArea, nCol, lstAllCellData, out baseCellData2);
				if (baseCellData != null && baseCellData2 != null)
				{
					result = baseCellData2.CellValue.ToDouble(0.0) - baseCellData.CellValue.ToDouble(0.0);
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		public static double CalcChgCellData(int nRow, int nCol, int nStartCol, List<BaseCellData> lstAllCellData, Autodesk.Revit.DB.Document doc)
		{
			double result = 0.0;
			try
			{
				if (nRow == CellRowValueNumManager.RowKindLevelTotalArchArea)
				{
					result = AreaCalcManager.CalcLevelTotalArchArea(nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowOvergroundArchArea)
				{
					result = AreaCalcManager.CalcOvergroundArchArea(lstAllCellData, doc);
				}
				else if (nRow == CellRowValueNumManager.RowUndergroundArchArea)
				{
					result = AreaCalcManager.CalcUndergroundArchArea(lstAllCellData, doc);
				}
				else if (nRow == CellRowValueNumManager.RowTotalArchArea)
				{
					result = AreaCalcManager.CalcTotalArchArea(nStartCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowInnerUseArea)
				{
					result = AreaCalcManager.CalcInnerUseArea(nRow, nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowTotalUseArea)
				{
					result = AreaCalcManager.CalcTotalCellArea(CellRowValueNumManager.RowInnerUseArea, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowTotalInnerArea)
				{
					result = AreaCalcManager.CalcTotalInnerArea(CellRowValueNumManager.RowInnerArea, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowTotalInnerArchArea)
				{
					result = AreaCalcManager.CalcTotalInnerArea(CellRowValueNumManager.RowInnerArea, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowPublicShareCoefficient)
				{
					result = AreaCalcManager.CalcPublicShareCoefficient(CellRowValueNumManager.RowInnerArea, CellRowValueNumManager.RowTotalInnerArchArea, nCol, nStartCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowPublicShareArea)
				{
					result = AreaCalcManager.CalcPublicShareArea(CellRowValueNumManager.RowPublicShareCoefficient, CellRowValueNumManager.RowUnitPublicShareArea, nCol, nStartCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowLevelPublicShareCoefficient)
				{
					result = AreaCalcManager.CalcLevelPublicShareCoefficient(CellRowValueNumManager.RowInnerArea, nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowLevelPublicShareArea)
				{
					result = AreaCalcManager.CalcLevelPublicShareArea(CellRowValueNumManager.RowLevelPublicShareCoefficient, CellRowValueNumManager.RowKindLevelArchArea, nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowCoverArea)
				{
					result = AreaCalcManager.CalcCoverArea(nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowSaleArea)
				{
					result = AreaCalcManager.CalcSaleArea(nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowOwnerInRoomRatio)
				{
					result = AreaCalcManager.CalcOwnerInRoomRatio(nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowOwnerOutRoomRatio)
				{
					result = AreaCalcManager.CalcOwnerOutRoomRatio(nStartCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowRealInRoomRatio)
				{
					result = AreaCalcManager.CalcRealInRoomRatio(nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowGiftRatio)
				{
					result = AreaCalcManager.CalcGiftRatio(nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowRealOutRoomRatio)
				{
					result = AreaCalcManager.CalcRealOutRoomRatio(nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowItemCount)
				{
					result = AreaCalcManager.CalcItemCount(nCol, lstAllCellData);
				}
				else if (nRow == CellRowValueNumManager.RowTotalShareArea)
				{
					result = AreaCalcManager.CalcTotalShareArea(nStartCol, lstAllCellData);
				}
				else
				{
					result = 0.0;
				}
			}
			catch (Exception)
			{
				return 0.0;
			}
			return result;
		}

		private static double CalcViewPlanArea(List<ViewPlan> lstArchPlane)
		{
			double num = 0.0;
			List<Area> list = new List<Area>();
			foreach (ViewPlan view in lstArchPlane)
			{
				List<SpatialElement> elemByClassWithView = FilterElementByClass.GetElemByClassWithView<SpatialElement>(view);
				if (elemByClassWithView != null && elemByClassWithView.Count > 0)
				{
					foreach (SpatialElement spatialElement in elemByClassWithView)
					{
						Area area = spatialElement as Area;
						if (area != null)
						{
							list.Add(area);
						}
					}
				}
			}
			foreach (Area area2 in list)
			{
				num += AreaParamManager.GetAreaAreaValue(area2);
			}
			return num;
		}

		public static double GetSumOneViewPlanArea(ViewPlan viewPlan)
		{
			double num = 0.0;
			List<SpatialElement> elemByClassWithView = FilterElementByClass.GetElemByClassWithView<SpatialElement>(viewPlan);
			List<Area> list = new List<Area>();
			foreach (SpatialElement spatialElement in elemByClassWithView)
			{
				Area area = spatialElement as Area;
				if (area != null)
				{
					list.Add(area);
				}
			}
			foreach (Area area2 in list)
			{
				num += AreaParamManager.GetAreaAreaValue(area2);
			}
			return num;
		}

		public static bool GetViewPlanAllValidArea(ViewPlan viewplan, ref List<Area> lstArea)
		{
			try
			{
				List<SpatialElement> elemByClassWithView = FilterElementByClass.GetElemByClassWithView<SpatialElement>(viewplan);
				List<Area> list = new List<Area>();
				foreach (SpatialElement spatialElement in elemByClassWithView)
				{
					Area area = spatialElement as Area;
					if (area != null)
					{
						list.Add(area);
					}
				}
				foreach (Area area2 in list)
				{
					if (Geometry.GreaterThan(area2.Area, 0.0))
					{
						lstArea.Add(area2);
					}
				}
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}

		public static bool GetCellData(int nRow, int nCol, List<BaseCellData> lstCellData, out BaseCellData cellData)
		{
			cellData = null;
			try
			{
				foreach (BaseCellData baseCellData in lstCellData)
				{
					if (baseCellData.RowNum == nRow && baseCellData.ColumnNum == nCol)
					{
						cellData = baseCellData;
						break;
					}
				}
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}

		public static double ChangeAreaByUnit(double tmpArea)
		{
			tmpArea = tmpArea * 304.8 * 304.8 / 1000.0 / 1000.0;
			return tmpArea;
		}
	}
}
